UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b8XV9YMWSmgbu68z6n+DSxS1iepiLOL+X4LMPlJG36Q='
WHERE
key_id = 'dd6f4e845de04f6c7b83d7d2e0645c22c65df63123e82e5e1346cda3fe2df9d4'
AND (
token = 'b8XV9YMWSmgbu68z6n+DSxS1iepiLOL+X4LMPlJG36Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)