UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1JNtFfDvXYJ+9I9fQ+2hLcL1XwJzpFa0TKuu5kwCmYI=' 
WHERE 
  key_id = '670f6c87296a179c63e7813799c3bc4123618b0f06c24ca83bc0d4edbfd2acb9' 
  AND (
    token = '1JNtFfDvXYJ+9I9fQ+2hLcL1XwJzpFa0TKuu5kwCmYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057