UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wY24VXgTrJryhFPJfrKUXCtBebxBhcDejIqdzCoZLhs=' 
WHERE 
  key_id = '7598a815e60203cb1f432c6066c3ecffd944a12760b5716abf9ded0a9768aff7' 
  AND (
    token = 'wY24VXgTrJryhFPJfrKUXCtBebxBhcDejIqdzCoZLhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037