UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pZdXsch4hn3n312h4Yqf8KqUf2QfBZqPAbDJbTIfcJ4=' 
WHERE 
  key_id = '7e348a494347713cf2548636d38821d0430573af7dc29b0277473ae8099a65d7' 
  AND (
    token = 'pZdXsch4hn3n312h4Yqf8KqUf2QfBZqPAbDJbTIfcJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032