UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JePOZUo9DOWGuTiD4IN59CqyQ9IAxiwotWk3dJEB5Vk='
WHERE
key_id = 'a12275898b83de85b6c76d9250c1900b0dd58df05a848ff48eeccf68b8f807d8'
AND (
token = 'JePOZUo9DOWGuTiD4IN59CqyQ9IAxiwotWk3dJEB5Vk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)