UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rkpOztqf8jtqBSvZf36XcG3FDErJjMOsXB691kWxQyo='
WHERE
key_id = 'c71218563bc2c734dd719a178aafba8ec3022dea788e1ab877713ef970b3703c'
AND (
token = 'rkpOztqf8jtqBSvZf36XcG3FDErJjMOsXB691kWxQyo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)