UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0a1gd7NCgRJAe2McXIoS9Q0pPxZimQOfUb54Y16N4Rc='
WHERE
key_id = '6e682f25aba716ad7d3c3926536c9098bb5564e827f75975d770fe3b518e40df'
AND (
token = '0a1gd7NCgRJAe2McXIoS9Q0pPxZimQOfUb54Y16N4Rc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)