UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fBWMvPbYUxEa5pn+e7375lDc2it1fOwVYwD8cfkqHuk='
WHERE
key_id = 'd1b94a99e31926acd694e43706b7363f19c961e3eddafe6b602df801045d4457'
AND (
token = 'fBWMvPbYUxEa5pn+e7375lDc2it1fOwVYwD8cfkqHuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)