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