UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VSg4XaSlV6+Sw0StUc2/fWAaD2BzWJGvooNtefIwOHs='
WHERE
key_id = 'f3f94abf488332fc4e76db498dbf193dd8731303f67e2126a016e9a0fde0c012'
AND (
token = 'VSg4XaSlV6+Sw0StUc2/fWAaD2BzWJGvooNtefIwOHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)