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