UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2AiQ1rgI41OIutjCftDrcY9SkhJ2OMll+um3kfu0y0='
WHERE
key_id = '2dc2dfa479be5eb749d0880a3995b018bb891626feea868de2e6c533c7ca38ee'
AND (
token = 'a2AiQ1rgI41OIutjCftDrcY9SkhJ2OMll+um3kfu0y0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)