UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nYJ6MT2Y/grAAanrVO1Jr3H5rxt3bDScwOND9bnsiro='
WHERE
key_id = 'f12e5e2063e65a2c53e9c38630e02942ff57f352c2dc61e024ab48adf2e68be9'
AND (
token = 'nYJ6MT2Y/grAAanrVO1Jr3H5rxt3bDScwOND9bnsiro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)