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