UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U5AEuIEQsDTvUZuLOg5KKYQEdNeqnhmfUZlHsyPaLt4=' 
WHERE 
  key_id = 'd33f8595266dbd05c52de76f557d839acf343a28ca04f4bcb3d9cad8201a4e3d' 
  AND (
    token = 'U5AEuIEQsDTvUZuLOg5KKYQEdNeqnhmfUZlHsyPaLt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073