UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd45CxeqXV3NiBKiDtwG0R+44Mr2jLAax1yE++E3xTpI='
WHERE
key_id = '767c2adb5451032610ab4539d8517290a82e0b0f3c28370ca97a841392c6d08f'
AND (
token = 'd45CxeqXV3NiBKiDtwG0R+44Mr2jLAax1yE++E3xTpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)