UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1rf6ofXm4UUn5mrXjrcOykglduROO16Etq35AdAuMs='
WHERE
key_id = '695ae118d22dfc30766c33f5b717e95640cf96b5496342f02d1ddb513125ccba'
AND (
token = 'B1rf6ofXm4UUn5mrXjrcOykglduROO16Etq35AdAuMs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)