UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r5utiflRbk2nfZmxYpUVNddyYEKVW2z/YZexZqGAk88=' 
WHERE 
  key_id = '9952c531efe7c46f15734a659209472fee6fa9b4acd356d767457ff21d97f400' 
  AND (
    token = 'r5utiflRbk2nfZmxYpUVNddyYEKVW2z/YZexZqGAk88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034