UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GHV4w01g+w/m7Nj/AuRCKgUjOAkw8sNMLF7Vo+AZ9/c=' 
WHERE 
  key_id = 'df91fe779515e44001de6896c877330cb80b0789649cca1cbcc8b1664bbf9763' 
  AND (
    token = 'GHV4w01g+w/m7Nj/AuRCKgUjOAkw8sNMLF7Vo+AZ9/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043