UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6/ybicHCKeFbS/BFaMrpqLALHq7BocbZfKK6mruLaac='
WHERE
key_id = '50d6e72096701a2dcc9da3acb30cf57fe6b0788dcde875ecccfdae820b468c3a'
AND (
token = '6/ybicHCKeFbS/BFaMrpqLALHq7BocbZfKK6mruLaac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)