UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zEJpImp0HI1jabvbl57uo7bVIQdAgT8CKuTpJaqZiqQ='
WHERE
key_id = '1ca66d5bad3577ae986181f52da8c966543709b68a278ff52a2ac4d97474d442'
AND (
token = 'zEJpImp0HI1jabvbl57uo7bVIQdAgT8CKuTpJaqZiqQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)