UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQr8zjcLsYC+BTP33+ZNYeCjTLk3PDi3nDgH5BVQfqo=' 
WHERE 
  key_id = '9305459efb01c6049e0da8e03aa1597cba8d416587e967a51d590741ab3ba118' 
  AND (
    token = 'bQr8zjcLsYC+BTP33+ZNYeCjTLk3PDi3nDgH5BVQfqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027