UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PV+5q6DbaMVQBNUC6O89UiUOEN4nnPeAD7ntTBRT0G0='
WHERE
key_id = 'd4599a021839b018d885e4e771de1f11c05a1d03fa80913285dda71002088e6a'
AND (
token = 'PV+5q6DbaMVQBNUC6O89UiUOEN4nnPeAD7ntTBRT0G0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)