UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '38Jap7Jn+FsUT+7gLhu6rKbGSB0NP9D4pPvbVXovv/8='
WHERE
key_id = 'ff89707c0f47839befbf28be042c8b9832ca0af64d1f1513b5d0603b76ef688d'
AND (
token = '38Jap7Jn+FsUT+7gLhu6rKbGSB0NP9D4pPvbVXovv/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)