UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6DdhtOOYSIQknZ2CneCJWvsgbo+1k8hyot+G48Ojkk='
WHERE
key_id = 'b600ab8d83b8c7a065f156a46a57b12c69d648356ceb06666d29b8a18381fec1'
AND (
token = 'a6DdhtOOYSIQknZ2CneCJWvsgbo+1k8hyot+G48Ojkk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)