UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'crlwTyRHw3xYh8bGEsDqW5I33MedSM/PRz+w9D93ZSE='
WHERE
key_id = 'b071827aff3813a555b7a53c486b7699ea3686937ffb254d1db26c3d6236547d'
AND (
token = 'crlwTyRHw3xYh8bGEsDqW5I33MedSM/PRz+w9D93ZSE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)