UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DobZSfgAJeXW2okAu4BdXInJMo8GE4MX+Q0BqYqoUJc=' 
WHERE 
  key_id = '6f1f433ee970a47c65566e3104121ca4ca48bd9a1791753198ef68516b02f749' 
  AND (
    token = 'DobZSfgAJeXW2okAu4BdXInJMo8GE4MX+Q0BqYqoUJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034