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