UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '59Jyzw/TIrVmBk6uPHX6G2bwjTbG9yEYyHaIa6/MeD4='
WHERE
key_id = '0a2e7079394c521209e15df2ad937632269909f749a2858c2a5d48a13e140974'
AND (
token = '59Jyzw/TIrVmBk6uPHX6G2bwjTbG9yEYyHaIa6/MeD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)