UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '036T2m3BXhZzSTLO27Htw4ri8lZogJrG5NRYyFj/lbg='
WHERE
key_id = '2602de667e03bf64598c01b884c5b25f2f33a1dcaa067cc4b2cddea6f6a2d604'
AND (
token = '036T2m3BXhZzSTLO27Htw4ri8lZogJrG5NRYyFj/lbg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)